package services.impl;

import bean.User;
import dao.UserMapper;
import dao.mapper.UserMapperImpl;
import services.UserService;
import util.DBUtil;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;

/**
 * @auther hewenhui
 * @see <a href="hetp://www.codingmaster.com> java </a>
 */
public class UserServiceImpl implements UserService {
    private UserMapper userMapper = new UserMapperImpl();

    @Override
    public int addUser(String phone_number, String password) {
        return userMapper.addUser(phone_number,password);
    }

    @Override
    public int login(String phone_number, String password) {

        return userMapper.login(phone_number,password);
    }

    @Override
    public User getUserByPhoneNumber(String phoneNumber) {
        return userMapper.getUserByPhoneNumber(phoneNumber);
    }

    @Override
    public int changePassword(int uid, String newPassword) {
        return userMapper.changePassword(uid,newPassword);
    }

    @Override
    public int upDataByUid(int uid, String phoneNumber, String username, String gender) {
        return userMapper.upDataByUid(uid,phoneNumber,username,gender);
    }
}
